<?php 

header("Content-type: image/jpeg");


//创建画布s
$src = imageCreateTrueColor(500,200); 

//设置颜色
$color = imageColorAllocate($src,192,192,192); 

//填充颜色
imageFill($src,0,0,$color);

$color = imageColorAllocate($src,255,242,0);

//随机填充颜色 mt_rand 生成更好的随机数，随机生成0-200的随机颜色
$color = imageColorAllocate($src,mt_rand(0,200),mt_rand(0,200),mt_rand(0,200));




//绘制空心矩形
// imagerectangle ( $src , 100 , 50 , 300 , 100, $color);


//绘制实心矩形
// imagefilledrectangle ( $src , 100 , 50 , 300 , 100, $color);


//绘制空心圆形
// imageellipse ( $src , 200 , 100 , 300 , 100, $color);

//绘制实心圆
// imagefilledellipse ( $src , 200 , 100 , 300 , 100, $color);


//循环绘制线条

for ($i=0; $i <30; $i++) { 
	$color = imageColorAllocate($src,mt_rand(0,200),mt_rand(0,200),mt_rand(0,200));

	imageline ( $src,mt_rand(0,500),mt_rand(0,50),mt_rand(0,500),mt_rand(100,200), $color);
}

for ($i=0; $i < 1000; $i++) { 
	$color = imageColorAllocate($src,mt_rand(0,200),mt_rand(0,200),mt_rand(0,200));
	imagesetpixel ($src, mt_rand(0,500) , mt_rand(0,200) ,$color );
}

//用特殊字体输入文本

// imagettftext ( $src , 100 , 0,100,150 , $color ,"./TENOCLOCK-Regular.ttf" , 'fhgj' );



for ($i=0; $i < 5; $i++) { 
	$str = "qwertyuioplkjhgfdsazxcvbnm1234567890";
	$type = $str[mt_rand(0,strlen($str)-1)];

	$width = $i*80;

	$width+=70;

	$height = mt_rand(150,150);

	$color = imageColorAllocate($src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,250));
	imagettftext ($src, 100 , mt_rand(10,10) ,$width ,$height,$color, "./TENOCLOCK-Regular.ttf" , $type);
}



//输出图像
imagejpeg($src);
imageDestroy($src);   














 ?>